#两数之和
'''
class Solution:
    def twoSum(self, nums, target):
        dict = {}
        for i in range(len(nums)):
            if target - nums[i] not in dict:
                dict[nums[i]] = i
            else:
                return [dict[target - nums[i]], i]
nums = [2, 7, 11, 15]
target = 9
print(Solution().twoSum(nums, target))
'''
class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        dic={}
        for i in range(len(nums)):

            if target-nums[i] not in dic:
                dic[nums[i]]=i

            else:
                return [dic[target-nums[i]],i]